<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<input type="text" id="num1" />
		<select id="算法">
			<option value="+">+</option>
			<option value="-">-</option>
			<option value="*">*</option>
			<option value="/">/</option>
		</select>
		<input type="text" id="num2" />
		<button type="button" onclick="sun();">运算</button>
		结果:<input type="text" id="num3" />
	</body>
	<script type="text/javascript">
		function sun(){
			var aa1 = document.getElementById('num1').value;
			var aa2 = document.getElementById('num2').value;
			var myselect = document.getElementById("算法");
			var index = myselect.selectedIndex;
			var af=myselect.options[index].value;
			document.getElementById('num3').value= eval(aa1+af+aa2);
		}
	</script>
</html>
